<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="renderer" content="webkit">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=10, user-scalable=no">
	<meta name="format-detection" content="telphone=no, email=no"/>
	<meta name="description" content="">
	<meta name="keywords" content="">
	<title>环境指数公众版</title>
	<link rel="stylesheet" type="text/css" href="assets/css/reset.css">
	<link rel="stylesheet" type="text/css" href="assets/css/iconfont/iconfont.css">
	<link rel="stylesheet" type="text/css" href="assets/css/app.css">
	<link rel="stylesheet" type="text/css" href="assets/css/car.css">
</head>
<body>
	<div class="pb-content">
		<div class="car-main" style="display: none">
			<div class="car_box">
				<div class="car_info">
					<div class="left_info">
						<span class="year" id="year"></span>
						<img src="assets/img/environmental_pic.png">
					</div>
					<div class="right_info" id="car_info">
						
					</div>
				</div>
				<!-- <div class="mark_info">
					<span class="mark_pic"></span>
					<span>您的年检将在本月底到期！ </span>
				</div> -->
			</div>
			<p class="source_tit">检测详情</p>
			<div class="test_box">
				<div class="test_info" id="test_info">
					
				</div>
				<div class="test_table" id="test_table">
					<table>
						<thead>
							<tr>
								<td width="34%"></td>
								<td width="33%">限值</td>
								<td width="33%">测量值</td>
							</tr>
						</thead>
						<tbody>
							
						</tbody>
					</table>
				</div>
				<div class="window_box">
					<ul>
						<li>
							<a href="environment-window.html?znmhlocation=true">
								<p><img src="assets/img/window.png"></p>
								<p class="window_name">环保窗口</p>
							</a>
						</li>
						<li>
							<a href="environment-monitoring.html?znmhlocation=true">
								<p><img src="assets/img/car_window.png"></p>
								<p class="window_name">环保检测站</p>
							</a>
						</li>
					</ul>
				</div>
			</div>
		</div>
		<div class="no-car-mian">
			<div class="padding-box" style="display: none">
				<p class="car-img"><img src="assets/img/car-pic.png"></p>
				<p class="car-text">您暂无绑定车辆！</p>
				<p class="car-btn"><a href="znmh://module/jia_wzdj">继续添加车辆</a></p>
			</div>
			<div class="window_box" style="margin-top: 50%;">
				<ul>
					<li>
						<a href="environment-window.html?znmhlocation=true">
							<p><img src="assets/img/window.png"></p>
							<p class="window_name">环保窗口</p>
						</a>
					</li>
					<li>
						<a href="environment-monitoring.html?znmhlocation=true">
							<p><img src="assets/img/car_window.png"></p>
							<p class="window_name">环保检测站</p>
						</a>
					</li>
				</ul>
			</div>
		</div>
	</div>
	<footer id="public_footer">
		<ul>
			<li>
				<a href="public.html">
					<span class="foot_pic environment"></span>
					<span>环境质量</span>
				</a>
			</li>
			
			<li class="active">
				<a href="car.html">
					<span class="foot_pic motor"></span>
					<span>机动车环保</span>
				</a>
			</li>
			<li>
				<a href="source.html?znmhlocation=true">
					<span class="foot_pic monitoring"></span>
					<span>国控源监控</span>
				</a>
			</li>
		</ul>
	</footer>
</body>
<script src="assets/js/jquery.js"></script>
<script type="text/javascript">
	var URL = 'http://58.213.141.220:8989/njhbindex';
	function getJSONData(url,callback){
      $.ajax({
          type: "get",
          contentType: "application/json; charset=utf-8",
          dataType: "json",
          url: url,  //这里是网址
          success: function (json) {
              callback(json)
          },
          timeout: 90*1000,
          error: function (XMLHttpRequest, textStatus, errorThrown) {
              console.error(url,textStatus+": "+errorThrown);
          }
      });
  	}


  	function request(paras){
	    var url = location.href;
	    var paraString = url.substring(url.indexOf("?")+1,url.length).split("&");
	    var paraObj = {};

	    for (i=0; j=paraString[i]; i++){
			paraObj[j.substring(0,j.indexOf("=")).toLowerCase()] = j.substring(j.indexOf("=")+1,j.length);
	    }

	    var returnValue = paraObj[paras.toLowerCase()];

	    if(typeof(returnValue)=="undefined"){
	    	return "";
	    }else{
	    	return returnValue;
	    }
	}

	var vn = request('vn');
	var mn = request('mn');

	if(vn==''||mn==''){
		$(".pb-content .no-car-mian").show();
		$(".pb-content .car-main").hide();
	}

	var mn6 = mn.substring(mn.length-6,mn.length);

  	getJSONData(URL+'/motoinfo?vn='+ vn +'&mn=' +mn6,function(data){
  		var _html = "";
  		if(data.success && data.data.length >0 ){
  			var list = data.data;
  			var year = list[0].hfrq;
  				year = year.split("-")[0];
  				$("#year").html(year);
  			$.each(list, function(i,e) {
  				_html = '<ul>'
						+'<li>'
							+'<span>标志编号：</span>'
							+'<span>'+e.mn+'</span>'
						+'</li>'
						+'<li>'
							+'<span>车牌号码：</span>'
							+'<span>'+e.cphm+'</span>'
						+'</li>'
						+'<li>'
							+'<span>牌照类型：</span>'
							+'<span>'+e.pzlx+'</span>'
						+'</li>'
						+'<li>'
							+'<span>核发日期：</span>'
							+'<span>'+e.hfrq+'</span>'
						+'</li>'
						+'<li>'
							+'<span>标志类型：</span>'
							+'<span>'+e.bzlx+'</span>'
						+'</li>'
						+'<li>'
							+'<span>到期时间：</span>'
							+'<span>'+e.dqsj+'</span>'
						+'</li>'
					+'</ul>';
  			});
  			$("#car_info").attr('data-sn',list[0].sn);
  			$("#car_info").empty().append(_html);
  		}
  		var sn = $("#car_info").attr('data-sn');
  		getJSONData(URL+'/motonj?sn='+sn,function(data){
  			if(data.data.length > 0){
  			var e = data.data[0];
  			var spanHtml = '';
  			spanHtml += '<span class="test_date">检测日期：'+e.jcrq+'</span><span class="test_type">检测状态：'+e.jczt+'</span>';
  			var trHtml = '';
  			trHtml += '<tr>'
							+'<td>5025co</td>'
							+'<td>1.8</td>'
							+'<td>'+e.co25_sz+'</td>'
						+'</tr>'
						+'<tr>'
							+'<td>5025HC</td>'
							+'<td>190</td>'
							+'<td>'+e.hc25_sz+'</td>'
						+'</tr>'
						+'<tr>'
							+'<td>2540NO</td>'
							+'<td>3400</td>'
							+'<td>'+e.no40_sz+'</td>'
						+'</tr>'
						+'<tr>'
							+'<td>2540CO</td>'
							+'<td>2.4</td>'
							+'<td>'+e.co40_sz+'</td>'
						+'</tr>'
						+'<tr>'
							+'<td>2540HC</td>'
							+'<td>190</td>'
							+'<td>'+e.hc40_sz+'</td>'
						+'</tr>'
						+'<tr>'
							+'<td>2540NO</td>'
							+'<td>3200</td>'
							+'<td>'+e.no40_sz+'</td>'
						+'</tr>'
						+'<tr>'
							+'<td>最终检测结果</td>';
						if(e.result == 'Y'){
							trHtml+='<td rowspan="1" colspan="2">通过</td>';
						}else if(e.result == 'N'){
							trHtml+='<td rowspan="1" colspan="2">不通过</td>';
						}
						+'</tr>';
			$("#test_info").append(spanHtml);
  			$(".test_table table tbody").empty().append(trHtml);
  		}
  		});
  	});
</script>
<script type="text/javascript">var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");document.write(unescape("%3Cspan style='display:none;' id='cnzz_stat_icon_1259663983'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "s11.cnzz.com/z_stat.php%3Fid%3D1259663983' type='text/javascript'%3E%3C/script%3E"));</script>